package com.motong.gongdan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.motong.gongdan.entity.Processes;
import com.motong.gongdan.vo.H5Vo.Dashboard.query.ProcessDetailQuery;
import com.motong.gongdan.vo.H5Vo.Dashboard.vo.ProcessStatisticsMissionVo;
import com.motong.gongdan.vo.H5Vo.Dashboard.vo.ProcessStatisticsVo;
import com.motong.gongdan.vo.resp.DataThirdResp;
import com.motong.gongdan.vo.resp.ProcessListHomeResp;
import com.motong.gongdan.vo.resp.WOProcessListResp;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface ProcessesMapper extends BaseMapper<Processes> {

    List<Processes> getListByIds(@Param("ids") List<String> ids);

    List<ProcessListHomeResp> getListForHomeProcessList(@Param("time") String time, @Param("type") Integer type);

    List<WOProcessListResp> getWorkOrderProcessByIds(@Param("ids") List<String> ids, @Param("workOrderCode") String workOrderCode);

    List<DataThirdResp> getDataThird();

    List<Processes> getProcesses(@Param("userId") Integer loginUserId);


    List<String> getProcessPermissionsUserName(@Param("id") Integer id);

    List<Processes> getProcessesByBP(@Param("id") String id);

    // 根据任务id获取工序信息
    Processes getByMissionId(@Param("missionId") Integer missionId);

    /**
     * 工序统计数据
     *
     * @param param 请求参数
     */
    Page<ProcessStatisticsVo> processStatistic(Page<Processes> processesPage, @Param("param") ProcessDetailQuery param);

    /**
     * 根据工单编码获取功序列表
     *
     * @param orderCodes 请求参数
     */
    List<ProcessStatisticsVo> getByOrderCodes(@Param("orderCodes") Set<String> orderCodes);

    /**
     * 根据用户id获取拥有权限的所有工序
     *
     * @param userId 用户id
     */
    List<Processes> getByUserId(@Param("userId") Integer userId);

    List<ProcessStatisticsMissionVo> getMissionNumByProcessId(@Param("query") ProcessDetailQuery query);
}
